package cn.hxth.dubbo.customer.controller;

import cn.hxth.api.model.Plant;
import cn.hxth.api.query.PageResult;
import cn.hxth.api.query.PlantQueryObject;
import cn.hxth.api.service.IPlantService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/pages/plant/")
public class PlantController {
    @Resource
    private IPlantService plantService;

    @RequestMapping("findAll")
    public PageResult findAll(PlantQueryObject plantQueryObject) {
        return this.plantService.findAll(plantQueryObject);
    }

    @RequestMapping("insertPlant")
    public boolean insertPlant(Plant plant) {
        return this.plantService.insertPlant(plant);
    }

    @RequestMapping("updatePlant")
    public boolean update(Plant plant) {
        return this.plantService.updatePlant(plant);
    }

    @RequestMapping("removePlant")
    public boolean removePlant(Integer cid) {
        return this.plantService.removePlant(cid);
    }

    @RequestMapping("getPlant")
    public Plant getPlant(Integer cid) {
        return this.plantService.getPlant(cid);

    }

    @ResponseBody
    @RequestMapping("getPlantForMq")
    public Plant getPlantForMq(Integer cid) {
        return this.plantService.getPlantForMq(cid);
    }
    @RequestMapping("updatePlantInstockRecordTime")
    public boolean updatePlantInstockRecordTime(int cid) {
        return this.plantService.updatePlantInstockRecordTime(cid);
    }
}
